<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>素材管理</title>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">
    <%@include file="../../include/commonFile.jsp" %>
</head>
<body>
<!--头部-->
<%@include file="../../include/header.jsp" %>
<div class="index-outside">
    <%@include file="../../include/sidebar.jsp" %>
    <!--内容-->
    <section>
        <div class="section-main">
            <form class="layui-form" action="${ctx}/member/notebook/list.do" id="myForm" method="post">
                <input type="hidden" name="pageNo" id="pageNo"/>
                <div class="f-search-bar">
                    <div class="search-container">
                        <ul class="search-form-content">
                            <c:if test="${!isChild || isXzgsAdmin}">
                                <li class="form-item-inline"><label class="search-form-lable">分社</label>
                                    <div class="layui-input-inline">
                                        <select name="memberGroupId">
                                            <option value="">全部</option>
                                            <c:forEach var="memberGroup" items="${memberGroupList}">
                                                <option value="${memberGroup.id}" ${notebookInput.memberGroupId == memberGroup.id ? 'selected="selected"' : ''}>${memberGroup.realname}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                </li>
                            </c:if>
                            <li class="form-item-inline"><label class="search-form-lable">笔记本标题</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="name" autocomplete="off" class="layui-input"
                                           value="${notebookInput.name}"
                                           placeholder="请输入笔记本标题">
                                </div>
                            </li>
                            <li class="form-item-inline">
                            </li>
                        </ul>
                        <ul class="search-form-content">
                            <li class="form-item"><label class="search-form-lable">发布时间</label>
                                <div class="check-btn-inner" id="timeType">
                                    <a id="all" href="javascript:void(0);"
                                       onclick="setTimeType($(this),0,'#myForm')" ${empty input.timeType || input.timeType == 0 ? 'class="active"' : ''}>全部</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),1,'#myForm')" ${input.timeType == 1 ? 'class="active"' : ''}>今天</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),2,'#myForm')" ${input.timeType == 2 ? 'class="active"' : ''}>本周内</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),3,'#myForm')" ${input.timeType == 3 ? 'class="active"' : ''}>本月内</a>
                                    <input type="hidden" name="timeType" value="${input.timeType}"/>
                                </div>
                                <div class="layui-inline">
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createStart"
                                               value="${input.createStart}" placeholder="开始日">
                                    </div>
                                    -
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createEnd"
                                               value="${input.createEnd}" placeholder="截止日">
                                    </div>
                                </div>
                            </li>
                            <li class="form-item-inline">
                                <div class="sub-btns">
                                    <a class="layui-btn layui-btn-danger"
                                       href="javascript:submitFunction('#myForm')">查询</a>
                                    <a class="layui-btn layui-btn-normal"
                                       href="javascript:resetFunction('#myForm')">重置</a>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </form>
            <div class="my-act-list-content">
                <ul id="view">
                    <table class="layui-table">
                        <colgroup>
                            <col width="60px">
                            <col width="90px">
                            <col width="165px">
                            <col width="15%">
                            <col width="95px">
                            <col width="80px">
                            <col width="110px">
                            <col width="100px">
                        </colgroup>
                        <thead>
                        <tr>
                            <th>序号</th>
                            <th>所属分社</th>
                            <th>所属者</th>
                            <th>标题</th>
                            <th>笔记本类型数量</th>
                            <th>素材数量</th>
                            <th>发布时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach var="notebook" items="${notebooks}" varStatus="st">
                            <tr>
                                <td>${page.limit * (page.page-1) + st.count}</td>
                                <td>
                                    <div class="act-title">
                                            ${notebook.memberGroupName}
                                    </div>
                                </td>
                                <td>
                                    <div class="act-title">
                                            ${notebook.memberGroupUserName}
                                    </div>
                                </td>
                                <td>
                                        ${notebook.name}
                                </td>
                                <td>
                                    <c:if test="${notebook.notebookTypeNum== 0}">
                                        <c:if test="${isChild && !isXzgsAdmin}">
                                               0
                                        </c:if>
                                        <c:if test="${!isChild || isXzgsAdmin}">
                                            <a href="${ctx}/member/notebook/type/form.do?notebookId=${notebook.id}"
                                                style="text-decoration:underline;color: blue">点击添加</a>
                                        </c:if>
                                    </c:if>
                                    <c:if test="${notebook.notebookTypeNum!= 0}">
                                        <a href="${ctx}/member/notebook/type/list.do?notebookId=${notebook.id}"
                                           style="text-decoration:underline;;color: blue">${notebook.notebookTypeNum}</a>
                                    </c:if>
                                </td>
                                <td>
                                    <c:if test="${notebook.materialTypeNum== 0}">
                                        ${notebook.materialTypeNum}
                                    </c:if>
                                    <c:if test="${notebook.materialTypeNum!= 0}">
                                        <a href="${ctx}/member/materialmgmt/list.do?notebookId=${notebook.id}"
                                           style="text-decoration:underline; color: blue">${notebook.materialTypeNum}</a>
                                    </c:if>
                                </td>
                                <td>
                                    <fmt:formatDate value="${notebook.createDate}" pattern="yyyy-MM-dd HH:mm"/>
                                </td>
                                <td class="opts-btns tb-opts">
                                    <c:if test="${!isChild || isXzgsAdmin}">
                                        <div class="comm-opts">
                                            <a href="${ctx}/member/notebook/form.do?id=${notebook.id}"
                                               class="green">编辑</a>
                                            <a href="${ctx}/member/notebook/copyForm.do?id=${notebook.id}"
                                               class="green">复制</a>
                                                <a href="javascript:txz.deleteObject('确定要删除吗？','${ctx}/member/notebook/delete.do?id=${notebook.id}');"
                                                   class="red">删除 </a>
                                        </div>
                                    </c:if>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </ul>
                <c:if test="${page.totalCount == 0}">
                    <c:if test="${!isChild ||isXzgsAdmin}">
                        <div class="f16 tc mt15">还没有数据，请点击右上角的“添加笔记本”</div>
                    </c:if>
                    <c:if test="${isChild &&!isXzgsAdmin}">
                        <div class="f16 tc mt15">还没有数据，请联系你的领导给你分配数据哦</div>
                    </c:if>
                </c:if>
                <div id="page_content" class="page-container"></div>
            </div>
        </div><!--底部-->
        <%@include file="../../include/footer.jsp" %>
    </section>
</div>

<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript" src="${ctx}/script/common/table_option.js"></script>
<script type="text/javascript">
    $(function () {
        //加载分页
        loadPageNew({
            elem: 'page_content',
            totalCount: '${page.totalCount}',
            limit: '${page.limit}',
            page: '${page.page}'
        });
        layui.use(['laydate'], function () {
            var laydate = layui.laydate;
            // 查询发布日期
            var start = {
                elem: 'input[name=createStart]'
            };
            var end = {
                elem: 'input[name=createEnd]'
            };
            laydate.render(start);
            laydate.render(end);
        });
    })
</script>
<script type="text/javascript">
    txz.initHeader({
        nav: [{
            name: '素材管理/笔记本',
            curr: true
        }],
        info: '<span class="f12">共<b id="totalCount">${page.totalCount}</b>条记录</span>'
        <c:if test="${!isChild || isXzgsAdmin}">
        ,
        btns: [{
            name: '添加笔记本',
            href: '${ctx}/member/notebook/form.do',
            icon: 'add'
        }]
        </c:if>
    });
</script>
</body>
</html>